package com.cskaoyan.service;

import com.cskaoyan.bean.vo.StatRowsVo;
import com.cskaoyan.bean.vo.StatUserVo;
import com.cskaoyan.mapper.StatMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StatServiceImpl implements StatService {
    @Autowired
    StatMapper statMapper;

    @Override
    public StatRowsVo getStatUser() {
        StatRowsVo statRowsVo = new StatRowsVo ();
        statRowsVo.setColumns (new String[]{"day", "users"});
        List<StatUserVo> statUser = statMapper.getStatUser ();
        statRowsVo.setRows (statUser);
        return statRowsVo;
    }

    @Override
    public StatRowsVo getStatOrder() {
        StatRowsVo statRowsVo = new StatRowsVo ();
        statRowsVo.setColumns (new String[]{"day", "orders", "customers", "amount", "pcr"});
        statRowsVo.setRows (statMapper.getStatOrder ());
        return statRowsVo;
    }

    @Override
    public StatRowsVo getStatGoods() {
        StatRowsVo statRowsVo = new StatRowsVo ();
        statRowsVo.setColumns (new String[]{"day", "orders", "products", "amount"});
        statRowsVo.setRows (statMapper.getStatGoods ());
        return statRowsVo;
    }
}
